<?php

/**
 * Description of Template
 *
 * @author Runner
 */
class Template {
    function awardsTemp($array=null){
        echo '
        <tr>
                <td align="right"><label for="name">奖励名称</label></td>
                <td><input type="text" name="name" id="name" value="'.$this->getValues($array, 'name').'"/></td>
            </tr>
            <tr>
                <td align="right"><label for="awardPerson">获奖人</label></td>
                <td><input type="text" name="awardPerson" id="awardPerson" value="'.$this->getValues($array, 'awardPerson').'"/></td>
            </tr>
            <tr>
                <td align="right"><label for="source">奖励来源</label></td>
                <td><input type="text" name="source" id="source" value="'.$this->getValues($array, 'source').'"/></td>
            </tr>
            <tr>
                <td align="right"><label for="time">获奖时间</label></td>
                <td><input type="text" name="time" id="time" value="'.$this->getValues($array, 'time').'" onClick="WdatePicker()"/></td>
            </tr>
        ';
    }
    
    function patentTemp($array=null){
        echo '
            <tr>
                <td align="right"><label for="name">专利名称</label></td>
                <td><input type="text" name="name" id="name" value="'.$this->getValues($array, 'name').'"/></td>
            </tr>
            <tr>
                <td align="right"><label for="responsible">责任人</label></td>
                <td><input type="text" name="responsible" id="responsible" value="'.$this->getValues($array, 'responsible').'"/></td>
            </tr>
            <tr>
                <td align="right"><label for="submitDate">提交日期</label></td>
                <td><input type="text" name="submitDate" id="submitDate" onClick="WdatePicker()"/></td>
            </tr>
            <tr>
                <td align="right"><label for="authorizeDate">授权日期</label></td>
                <td><input type="text" name="authorizeDate" id="authorizeDate" onClick="WdatePicker()"/></td>
            </tr>
            <tr>
                <td align="right"><label for="state">状态</label></td>
                <td><input type="text" name="state" id="state"/></td>
            </tr>
            <tr>
                <td align="right"><label for="auditingState">审核状态</label></td>
                <td>
                    <select name="auditingState" id="auditingState">
                        <option>未审核</option>
                        <option>已审核</option>
                    </select>
                </td>
            </tr>
        ';
    }
    
    /**
     *  获得数组中的属性。数组不存在返回空字符串
     * @param type $array
     * @param type $name
     */
    private function getValues($array=null, $name=null){
        if($array==null){
            return "";
        }
        if(isset($array[$name])){
            return $array[$name];
        }
        return "";
    }
}
